Skip to content

feat(preset): nexusx spec-kit preset (4-phase SDD on spec-kit)#97

Open
allmonday wants to merge 1 commit into
masterfrom
feat/preset-nexusx
Open

feat(preset): nexusx spec-kit preset (4-phase SDD on spec-kit)#97
allmonday wants to merge 1 commit into
masterfrom
feat/preset-nexusx

Conversation

@allmonday

Copy link
Copy Markdown
Collaborator

Summary

skill/ 里的 nexusx 4-phase 方法论迁到 spec-kit preset,让用户跑标准 /speckit-specify/speckit-plan/speckit-tasks 时拿到 nexusx 风味的输出(Phase 0 八步访谈、nexusx Technical Context、phase-tagged tasks)。skill/ 保留不动作为 fallback。

What's bundled

presets/nexusx/ — 12 files:

文件 作用
preset.yml manifest,提供 4 模板 + 3 命令(全 replace 策略,跟随 lean preset)
templates/constitution-template.md 8 条硬规则(lazy=noload / 实体纯净 / DTO 纯净 / UseCase 返回注解 / MCP 传输等)+ V 型验收治理
templates/spec-template.md spec-kit 用户故事骨架 + 前置 Phase 0 需求确认纪要(实体/关系/聚合根/Service切分候选/DB选型)
templates/plan-template.md nexusx Technical Context(DB选型 / async+sync URL / alembic / Service切分最终方案 / 是否 TS SDK)
templates/tasks-template.md phase-first 混合:Schema → Methods → Service → 可选 SDK;每 task 带 [P1]/[P2]/[P3]/[P4]
commands/speckit.specify.md 注入 Phase 0 八步访谈,含 Service 切分强制门(Constitution IV)
commands/speckit.plan.md 注入 DB选型 / alembic / TS SDK 决策访谈;强制 Phase 0 完整性检查
commands/speckit.tasks.md phase 标签规则 + reference doc 链接 + Phase 4 条件生成
reference/phase{1,2,3}.md skill/phases/ 复制(preset 自包含;带同步头)

scripts/preset-reinstall.shspecify preset add --dev 是 copy-based,每次源码改动需重装。脚本封装 remove + add + 验证 resolve。

Plan agent 关键修正

  • wrap 不可用:原计划用 wrap 策略行间注入,Plan agent 指出 wrap 只支持 {CORE_TEMPLATE} 占位符前后追加,不能交错。改用 replace(mirror lean preset 模式)。
  • preset.yml 字段名:spec-kit 把 templates 和 commands 都放在 provides.templates 下用 type: 区分,不存在 provides.commands。第一版用错字段导致命令未注册,已修。
  • 006-skill-template-polish 不存在:原计划用作回归对照,实际 specs/ 里已重命名为 006-voyager-about-tab。改为建议用 007-preset-test

Status

Preset 安装链路已验证:

✓ specify preset add --dev ./presets/nexusx  →  installed (priority 10)
✓ Templates: 7 (4 templates + 3 commands)
✓ registered_commands: claude → [speckit.specify, speckit.plan, speckit.tasks]
✓ registered_skills: [speckit-specify, speckit-plan, speckit-tasks]
✓ .claude/skills/speckit-{specify,plan,tasks}/SKILL.md → source: preset:nexusx
✓ 4 templates resolve to nexusx override (not core)

Test plan

Pre-check(已通过):

  • bash scripts/preset-reinstall.sh 退出码 0
  • specify preset list 列出 nexusx
  • specify preset resolve spec-template 指向 nexusx
  • .claude/skills/speckit-specify/SKILL.md description 是 nexusx 文案

End-to-end(待 user 实测,Phase 0 访谈需要 user 回答):

# 在 nexusx repo root
/speckit-specify 为 demo/blog 增加 post 评论功能

验证:

  • Phase 0 八步访谈逐项发起(实体表 / ER 图 / 聚合根 / Service切分候选 / DB选型)
  • Service 切分候选方案强制门触发(未选时停 SPEC_PHASE0_BLOCKED
  • DB 选型强制门触发
  • specs/007-*/spec.md 包含 ## Phase 0 需求确认纪要 区块
/speckit-plan

验证:

  • specs/007-*/plan.md Technical Context 含 nexusx 字段(DB 选型 / async URL / sync URL / alembic / Service 切分 / TS SDK 决策)
  • Constitution Check 引用 8 条原则
  • TS SDK 决策访谈发起
/speckit-tasks

验证:

  • specs/007-*/tasks.md 按 Phase 1 Schema → 2 Methods → 3 Service 组织
  • 每 task 带 [P1]/[P2]/[P3] phase 标签 + [USx]
  • 每 phase 顶部链接 presets/nexusx/reference/phaseN.md
  • TS SDK 为"否"时 Phase 4 完全省略(不留空骨架)

Open issues(非阻塞,留 v2)

  • Constitution 是 LLM-advised 不是 hard-gated;运行时才报错(如 MissingReturnAnnotationError)。v2 可考虑加 phase-exit checklist 模板。
  • reference/phase{1,2,3}.md 会与 skill/phases/ 漂移;已加同步头注释让 drift grep-able。
  • 替换策略耦合 spec-kit 版本;pin >=0.6.0,上游命令结构改了需要手动 re-sync。

🤖 Generated with Claude Code

Migrate the nexusx 4-phase methodology from a hand-driven skill into a
spec-kit preset so users get the iterative specify/plan/tasks workflow
plus nexusx-specific interview gates and constitution enforcement.

What's bundled (presets/nexusx/):

- preset.yml — manifest, 4 templates + 3 command overrides (replace
  strategy following lean preset's pattern; wrap can't interleave).
- templates/constitution-template.md — 8 hard rules (lazy=noload,
  entity-purity, DTO purity, UseCase return annotation, MCP transport,
  etc.) + V-型验收 + inter-phase pause governance.
- templates/spec-template.md — spec-kit user-story spine with a Phase 0
  需求确认纪要 prepended (entities / 关系 / 聚合根 / Service切分候选 /
  DB选型). Magic strings like [NEEDS CLARIFICATION] stay English so the
  checklist validator still detects them.
- templates/plan-template.md — nexusx Technical Context (DB选型 /
  async+sync URL / alembic / Service切分最终方案 / 是否生成 TS SDK).
- templates/tasks-template.md — phase-first hybrid: Schema → Methods →
  Service → optional SDK. Every task carries [P1]/[P2]/[P3]/[P4] phase
  tag plus [USx] story tag.
- commands/speckit.specify.md — full Phase 0 八步访谈 with hard gate
  on Service切分 (Constitution Principle IV: must propose candidate
  and get explicit user choice).
- commands/speckit.plan.md — DB选型 + alembic + 第三方库 + TS SDK
  决策访谈; verifies Phase 0 completeness before proceeding.
- commands/speckit.tasks.md — phase tagging rule + reference doc
  linking + conditional Phase 4 emission based on plan's TS SDK flag.
- reference/phase{1,2,3}.md — copied from skill/phases/ with sync
  header (preset self-contained for future publishing).

Also: scripts/preset-reinstall.sh wraps the copy-based reinstall flow
(`specify preset add --dev` is not symlink-based, so each source edit
needs re-install).

skill/ stays untouched — preset is the preferred path going forward,
skill remains as fallback. End-to-end test plan in the PR description.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant